import * as Cesium from "cesium"

type EntityMaterialType = Cesium.Color | Cesium.MaterialProperty
export interface DrawerStyle {
  polygon?: Cesium.PolygonGraphics.ConstructorOptions
  polyline?: Cesium.PolylineGraphics.ConstructorOptions
  point?: Cesium.PointGraphics.ConstructorOptions
  rectangle?: Cesium.RectangleGraphics.ConstructorOptions
  arrow?: {
    material: EntityMaterialType
  }
}
//主题颜色
const baseColor = Cesium.Color.ORANGE
//线条材质
const lineMaterial = new Cesium.PolylineOutlineMaterialProperty({
  color: baseColor,
  outlineWidth: 0,
})
//被遮挡时的材质
const depthFailMaterial = new Cesium.PolylineOutlineMaterialProperty({
  color: baseColor.withAlpha(0.5),
  outlineWidth: 0,
})
//面材质
const fillMaterial = Cesium.Color.ORANGE.withAlpha(0.5)
//默认样式
export const defaultStyle: DrawerStyle = {
  polygon: {
    fill: true,
    material: fillMaterial,
    // perPositionHeight: true,
  },
  polyline: {
    width: 5,
    material: lineMaterial,
    depthFailMaterial,
  },
  point: {
    pixelSize: 5,
    color: Cesium.Color.WHITE,
    outlineWidth: 3,
    outlineColor: baseColor,
    disableDepthTestDistance: Number.MAX_VALUE,
  },
  rectangle: {
    fill: true,
    material: fillMaterial,
  },
}
